"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""

import os
import django
from channels.http import AsgiHandler
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.security.websocket import AllowedHostsOriginValidator
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lawoffice.settings')
django.setup()


import wxchat.routing


application = ProtocolTypeRouter({
  "http": AsgiHandler(),
  'websocket': AllowedHostsOriginValidator(
      AuthMiddlewareStack(
          URLRouter(
            wxchat.routing.websocket_urlpatterns
          )
      )
  ),
})
